<?php
namespace Lib\Utils\sha1;

final class Signature
{
  private $params;
  private $apiKey;

  function __construct($params, $apiKey)
  {
    $this->params = $params;
    $this->apiKey = $apiKey;
  }

  function sign()
  {
    ksort($this->params);
    $string = "";
    foreach ($this->params as $name => $value) {
      $string .= $name . '=' . $value . '&';
    }
    $string = substr($string, 0, strlen($string) -1 );
    $string .= $this->apiKey;
    return strtoupper(sha1($string));
  }

}
